<?php

namespace App\Listeners;

use Illuminate\Support\Facades\Db;
use Illuminate\Support\Facades\Log;
use Laravel\Passport\Events\RefreshTokenCreated;

class PruneOldTokens{

    /********************************该类主要用于清除旧的refresh_access_token*****************************************************/
    /**
     * Create the event listeners
     *
     * @return void
     * */
    public function __construct()
    {

    }

    /**
     * Handle the event
     *
     * @param RefreshTokenCreated $event
     * @return void
     * */
    public function handle(RefreshTokenCreated $event)
    {
        /*Log::info('event_refresh_accessToken:'.json_encode($event));

        Db::table('oauth_refresh_tokens')
            ->where('access_token_id','<>',$event->accessTokenId)
            ->where('revoked','=',0)
            ->update(['revoked'=>1]);*/

    }
}